﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using nyxwin.Common.Base.Common;
using System.Collections.Generic;

namespace nyxwin.Main.Base.ViewModels
{
    public abstract class PivotItemViewModel : BaseViewModel
    {
        public abstract string Title { get; }

        public virtual void Enter() { }
        public virtual void Leave() { }

        public virtual IEnumerable<AppBarButton> AppBarButtons { get { return new AppBarButton[] { }; } }
    }

    public class AppBarButton : NotifyingObject
    {
        public AppBarButton(Uri iconUri, Action clickAction)
        {
            this.Uri = iconUri;
            this._title = string.Empty;
            this._clickAction = clickAction;
        }

        private string _title;

        public string Title
        {
            get { return _title; }
            set
            {
                _title = value;
                RaisePropertyChanged(() => Title);
            }
        }

        public Uri Uri { get; private set; }

        private bool _isEnabled;
        private Action _clickAction;

        public bool IsEnabled
        {
            get { return _isEnabled; }
            set
            {
                _isEnabled = value;
                RaisePropertyChanged(() => IsEnabled);
            }
        }

        public void Click()
        {
            if (_clickAction != null)
                _clickAction.Invoke();
        }
    }
}
